package com.dk.academic.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2018-10-10
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016092200568757";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCD7Ug/xcwHmQbSPUQONpeIo0PC1knd1jqV7jRmfY6cfrDl/Q/agpI4GzRveW2SjjgDIFovcyPdsnAuIdJ5nWHa4IZEFg5XRwg0UZIMnFXLGxXhuwc6UmPgFAZs3etyySNqphhFuqpAS2RJUAz8M06pkpKBRIWebV/aIruTtnTPAlNth12Uv6Gs/cj+lhIReMYwRELTFAmwZIGP+qwecUk79th7/G9G/OP08ANhtZxR5rWjgk1KNRpn/829LOC3VjUAHTLrmYrWj1U0LAvYbV45eR5lBomLLCBS3AbcjoM+eFnAvIC1l4py/AeRlJLHUKQeIh5plPcwGnAAuCkUDB+dAgMBAAECggEAfteOBprDf26XC16SZ2P/sAThapwjqyGFdI/xW7VOf5KjvIziSEIQGde2Q5OpUSZiHkdlzodSrZ4Zk5E7T2iNJCeJkD7wjOOjtMHUvUE2j7A8CquK2H1Mv64hO1znOpa+8ZQ+dBR0CpsyEfbgdT9TW2CscZMTMW6RoSaR2QStLDXspHAzZXUGTlUgH8w3RNFvEikUQfbBZDn+fZfB5cRCzVcsRfIytvq1qS/Dadd8Wtof2dGPWKjVRfOXWLsmjeAbdBc5txxN2PoiCsTyFvnDXGGKEaiHrEJiIQvSK6fbdAwvPlJOAI+nYHAdbASCR78foqZFLARUAye3bPqRV0eN1QKBgQD2Qz356M+ug9tf7UsgMs4svNxpo+q2fAMIAiCvusjAsbMryMpp2SGYuU6ux9H3GYa7mAVFodwDdJVFud0ygqW7GHmeJrQLrtfqBtWZPP4F//ObhMwkVIzY8aY0dsV9CzHp10RZcIb3wXtVyAq/EQua6ZqMHpLJDPtBNAvivXmiqwKBgQCJJLFfdLKwJ+OzE1S1GDBA07BeCoXwUx5C5BuBIFuR25CWtjMvPhjNQ0Ea5zE1CYuapqYBp+7QzsprfasF2y7+dNWM0ipaWF5ONbkreOPDJf8G+O9+GD6Zaeeg8H0Q5Ng3fGsAOAdWrGsNd6xw0Zo5C54kFKqxMDvHQ8kfjz2G1wKBgQCAExCUfIQmWuUoypybrlCT69UmC93x8iURcSnWuunVbZWlW9QJoKdcamOFet60CE6OGc4EHN3z3hoUHUnxDwlqeJwnqDFTMieQyuUjwRjLvgXQCAyziFWILoUmG+8xzTS0TQR7D47iI3olbthH7nF+q6d44B2u+lVh39OepLQx6QKBgEiQNZmAMZurP3tc2xEGv2FNoJ/hiYTjNbvG3hawfELsndBgjyyL+quAzk3hzdN2PXuSeXue02mAQPInB/qNQow4XVWpTeeHoj5XhqZNzJVQ4WNbC7z4LwcVVg19sW7i5tRU7HitLJTbnbj+fSskfCl60C3fEYG3N6nzX9NnAvL5AoGACDrNEHmWnPUEmv7uggt/fEp+gplhBBiNkmPQtVRFJgxRRfvicQrnkO9AvrX+vttXVcW/jo52IeWofzs/Zx5tJHO4o04Dm2GZgH9Dsp+xauL4VOMm/lyw6Wnw34kKtIhAjP/G52EI6uUNive11odTEhPcK9sxsJzwGvapNh+VNik=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg+1IP8XMB5kG0j1EDjaXiKNDwtZJ3dY6le40Zn2OnH6w5f0P2oKSOBs0b3ltko44AyBaL3Mj3bJwLiHSeZ1h2uCGRBYOV0cINFGSDJxVyxsV4bsHOlJj4BQGbN3rcskjaqYYRbqqQEtkSVAM/DNOqZKSgUSFnm1f2iK7k7Z0zwJTbYddlL+hrP3I/pYSEXjGMERC0xQJsGSBj/qsHnFJO/bYe/xvRvzj9PADYbWcUea1o4JNSjUaZ//NvSzgt1Y1AB0y65mK1o9VNCwL2G1eOXkeZQaJiywgUtwG3I6DPnhZwLyAtZeKcvwHkZSSx1CkHiIeaZT3MBpwALgpFAwfnQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://www.soulblack.top/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http:/www.soulblack.top/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}